//
//  DataTool.m
//  HaoHint
//
//  Created by winter on 16/5/26.
//  Copyright © 2016年 wd. All rights reserved.
//

#import "DataTool.h"

@implementation DataTool

+ (void)saveData:(NSArray *)array
{
    NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject];
    
    NSString *path = [docPath stringByAppendingPathComponent:@"data.time"];
    
    [NSKeyedArchiver archiveRootObject:array toFile:path];
}

+ (NSArray *)readData
{
    NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject];
    
    NSString *path = [docPath stringByAppendingPathComponent:@"data.time"];
    
    NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
    return array;
}
@end
